package com.yjs.houtai.controller;

import com.yjs.houtai.entity.Customer;
import com.yjs.houtai.entity.Message;
import com.yjs.houtai.service.CustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@Api(tags = "用户模块")
@RestController
@RequestMapping("/api/customer")
public class CustomerController {
    @Resource
    private CustomerService customerService;

    @ApiOperation(value="增加顾客")
    @PostMapping("/insert")
    public Message insertSelective(Customer customer){

        return customerService.insertSelective(customer);
    }


    @ApiOperation(value="修改顾客部分信息")
    @PutMapping("/update")
    public Message updateByPrimaryKeySelective(Customer customer) {
        return customerService.updateByPrimaryKeySelective(customer);
    }

    @ApiOperation(value = "查询顾客信息")
    @GetMapping("/select")
    public Message selectByPrimaryKey(int customerId)
    {
        return customerService.selectByPrimaryKey(customerId);
    }

    @ApiOperation(value = "查询所有顾客信息")
    @GetMapping("/selectAll")
    public  Message selectAll(){
        return customerService.selectAll();
    }

    @ApiOperation(value="删除顾客信息")
    @DeleteMapping("/delete")
    public Message deleteByPrimaryKey(int customerId){
        return customerService.deleteByPrimaryKey(customerId);
    }
}
